<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<link rel="stylesheet" type="text/css" href="../bootstarp-3.3.7/css/bootstrap.min.css" />
		<script src="../assets/js/jquery-2.0.3.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../bootstarp-3.3.7/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../bootstarp-table-1.11.1/bootstrap-table.min.css" />
		<script src="../bootstarp-table-1.11.1/bootstrap-table.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../bootstarp-table-1.11.1/bootstrap-table-zh-CN.min.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			#text {
				text-align: right;
			}
		</style>
		<script type="text/javascript">
			$(function() {
				/* 主界面表格*/
				$("#scheduleTable").bootstrapTable({
					url: "../schedule/getAllSchedule.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					//					queryParams:queryParams,//方法返回参数
					columns: [{
						title: "调度号",
						field: 'sched_id',
						align: 'center',
						valign: 'middle',
					}, {
						title: "调度类型",
						field: 'name',
						align: 'center',
						valign: 'middle',
					}, {
						title: "状态",
						field: 'schstatus',
						align: 'center',
						valign: 'middle',
					}, {
						title: "提交",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							var d = "<button type='button' class='btn btn-success glyphicon glyphicon-ok' onclick='submitSchedule("+JSON.stringify(row)+")'></button>";

							return d;
						}
					}, {
						title: "更新",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<button type='button' class='btn btn-info glyphicon glyphicon-edit' onclick='upModal(" + JSON.stringify(row) + ")'></button>";

						}
					}, {
						title: "删除",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<button type='button' class='btn btn-danger glyphicon glyphicon-trash' onclick='delSchedule(" + row.sched_id + ")'></button>";

						}
					}]
				})

				/*车辆信息表格*/
				$("#carTable").bootstrapTable({
					//					url: "../schedule/selectOneCar.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					//					queryParams:carQP,//方法返回参数
					columns: [{
						title: "车牌号",
						field: 'license',
						align: 'center',
						valign: 'middle',
					}, {
						title: "车辆类型",
						field: 'trucktype',
						align: 'center',
						valign: 'middle',
					}, {
						title: "吨位",
						field: 'carry_capcty',
						align: 'center',
						valign: 'middle',
					}, {
						title: "车辆所有权",
						field: 'name',
						align: 'center',
						valign: 'middle',
					}, {
						title: "删除",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<button type='button' class='btn btn-danger glyphicon glyphicon-trash' onclick='delCar()'></button>";

						}
					}]
				})

				/*司机信息表格*/
				$("#driverTable").bootstrapTable({
					//					url: "../schedule/getAllTruck.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					//										queryParams:queryParams,//方法返回参数
					columns: [{
						title: "司机名称",
						field: 'name',
						align: 'center',
						valign: 'middle',
					}, {
						title: "驾驶证",
						field: 'license',
						align: 'center',
						valign: 'middle',
					}, {
						title: "联系电话",
						field: 'contact',
						align: 'center',
						valign: 'middle',
					}, {
						title: "删除",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<button type='button' onclick='delDriver()' class='btn btn-danger glyphicon glyphicon-trash'></button>";

						}
					}]
				})

				/*承运商信息表格*/

				$("#carrierTable").bootstrapTable({
					//										url: "../schedule/getAllSchedule.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					//					queryParams:queryParams,//方法返回参数
					columns: [{
						title: "承运商姓名",
						field: 'name',
						align: 'center',
						valign: 'middle',
					}, {
						title: "地址",
						field: 'address',
						align: 'center',
						valign: 'middle',
					}, {
						title: "联系人",
						field: 'contact',
						align: 'center',
						valign: 'middle',
					}, {
						title: "承运商电话",
						field: 'phone',
						align: 'center',
						valign: 'middle',
					}, {
						title: "删除",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<button type='button' onclick='delCarrier()' class='btn btn-danger glyphicon glyphicon-trash'></button>";

						}
					}]
				})

				//搜索车辆表格
				$("#carTable2").bootstrapTable({
					url: "../schedule/getAllTruck.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					queryParams: carParams, //方法返回参数
					columns: [{
						title: "车牌号",
						field: 'license',
						align: 'center',
						valign: 'middle',
					}, {
						title: "车辆类型",
						field: 'trucktype',
						align: 'center',
						valign: 'middle',
					}, {
						title: "吨位",
						field: 'carry_capcty',
						align: 'center',
						valign: 'middle',
					}, {
						title: "车辆所有权",
						field: 'name',
						align: 'center',
						valign: 'middle',
					}, {
						title: "指定该车",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<a href='javascript:appointCar(" + JSON.stringify(row) + ")'><span class='glyphicon glyphicon-ok'></span></a>";
						}
					}]

				})

				//搜索司机表格
				$("#driverTable2").bootstrapTable({
					url: "../schedule/getDriver.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					queryParams: driverParams, //方法返回参数
					columns: [{
						title: "司机名称",
						field: 'name',
						align: 'center',
						valign: 'middle',
					}, {
						title: "驾驶证",
						field: 'license',
						align: 'center',
						valign: 'middle',
					}, {
						title: "联系电话",
						field: 'contact',
						align: 'center',
						valign: 'middle',
					}, {
						title: "指定该司机",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<a href='javascript:appointDriver(" + JSON.stringify(row) + ")'><span class='glyphicon glyphicon-ok'></span></a>";
						}
					}]

				})

				//搜索承运商表格
				$("#carrierTable2").bootstrapTable({
					url: "../schedule/getAllThirdParty.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					queryParams: thirdPartyParams, //方法返回参数
					columns: [{
						title: "承运商姓名",
						field: 'name',
						align: 'center',
						valign: 'middle',
					}, {
						title: "地址",
						field: 'address',
						align: 'center',
						valign: 'middle',
					}, {
						title: "联系人",
						field: 'contact',
						align: 'center',
						valign: 'middle',
					}, {
						title: "承运商电话",
						field: 'phone',
						align: 'center',
						valign: 'middle',
					}, {
						title: "指定该承运商",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<a href='javascript:appointCarrier(" + JSON.stringify(row) + ")'><span class='glyphicon glyphicon-ok'></span></a>";
						}
					}]
				})

				//车辆类型下拉框赋值
				$.getJSON("../schedule/getAllTrucktype.lgg", function(data) {
					for(var i = 0; i < data.length; i++) {
						$("#trucktype").append("<option value='" + data[i].trucktype + "'>" + data[i].trucktype + "</option>");
					}
				})

				//车辆所有者下拉框赋值
				$.getJSON("../schedule/getAllOname.lgg", function(data) {
					for(var i = 0; i < data.length; i++) {
						$("#otid").append("<option value='" + data[i].owner_type_id + "'>" + data[i].name + "</option>");
					}
				})

				//车辆查询
				$("#carBtn").click(function() {
					$("#carTable2").bootstrapTable("refresh");

				})

				//司机查询
				$("#driverBtn").click(function() {
					$("#driverTable2").bootstrapTable("refresh");
				})

				//承运商查询
				$("#carrierBtn").click(function() {

					$("#carrierTable2").bootstrapTable("refresh");
				})

				$("#carModal").on('hidden.bs.modal', function() {
					$("body")[0].className = 'modal-open';

				})

				$("#driverModal").on('hidden.bs.modal', function() {
					$("body")[0].className = 'modal-open';

				})

				$("#carrierModal").on('hidden.bs.modal', function() {
					$("body")[0].className = 'modal-open';

				})
				
				$("#proModal").on('hidden.bs.modal', function() {
					$("body")[0].className = 'modal-open';

				})

				//获取出发地坐标
				$("#fromaddress").blur(function() {

					$.ajax({
						type: "post",
						url: "http://api.map.baidu.com/geocoder/v2/?address=" + $("#fromaddress").val() + "&output=json&ak=K3wCeEAXVptazX0cb9kl85aN6NMKGxcg&sn=7de5a22212ffaa9e326444c75a58f9a0",
						dataType: "jsonp",
						success: function(data) {

							$("#fromaddresszb").val(data.result.location.lng + "," + data.result.location.lat)

						}
					});
				})

				//获取到达地坐标
				$("#toaddress").blur(function() {
					$.ajax({
						type: "post",
						url: "http://api.map.baidu.com/geocoder/v2/?address=" + $("#toaddress").val() + "&output=json&ak=K3wCeEAXVptazX0cb9kl85aN6NMKGxcg&sn=7de5a22212ffaa9e326444c75a58f9a0",
						dataType: "jsonp",
						success: function(data) {
							$("#toaddresszb").val(data.result.location.lng + "," + data.result.location.lat)

						}
					});
				})

				//添加调度信息
				$("#addSheduleBtn").click(function() {

					$.ajax({
						type: "post",
						url: "../schedule/addSchedule.lgg",
						data: $("#addForm").serialize(),
						success: function(data) {
							alert("添加成功")
							$("#schedModal").modal("hide")
							$("#scheduleTable").bootstrapTable("refresh")
						}
					});

				})
				
				$("#proBtn").click(function(){
//					alert($("#product_pname").val())
					$("#proTable").bootstrapTable("refresh")
					
				})
				
				$("#upSheduleBtn").click(function(){

					$.ajax({
						type: "post",
						url: "../schedule/upSchedule.lgg",
						data: $("#upForm").serialize(),
						success: function(data) {
							$("#upSchedModal").modal("hide")
//							alert(data)

						}
					});
				})

			})
			
			//提交调度
			function submitSchedule(row){
//				alert(row.exec_done_flag+","+row.sched_id)
                if (row.schstatus=='正在调度') {
					  $.ajax({
                	type:"post",
                	url:"../schedule/submitSchedule.lgg",
                	data:"sched_id="+row.sched_id+"&exec_done_flag="+row.exec_done_flag,
                	success:function(data){
                		alert("调度成功！")
                		$("#scheduleTable").bootstrapTable("refresh")
                		
                	}
                });
				}else if(row.schstatus=='调度完成'){
					alert("调度完成！不能再次提交!")
				}
              
				
			}


			//查询调度信息
			function upModal(row) {
				$("#truck_id2").val(row.truck_id)
				$("#driver_id2").val(row.driver_id)
				$("#third_party_id2").val(row.third_party_id)
				$("#sched_id").val(row.sched_id)
				$("#UpCarTable").bootstrapTable("destroy")
				$("#UpDriverTable").bootstrapTable("destroy")
				$("#UpCarrierTable").bootstrapTable("destroy")
				$("#UpProTable").bootstrapTable("destroy")
				$("#proTable").bootstrapTable("destroy")
//				alert(row.truck_id)
//				alert(row.driver_id)
//				alert(row.third_party_id)
				if (row.schstatus=='正在调度') {
					$("#upSchedModal").modal("show")
				} else{
					alert("该单调度完成！无需修改")
				}
				
				
				/*修改：车辆信息表格*/
				$("#UpCarTable").bootstrapTable({
					url: "../schedule/upSelectOneCar.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					queryParams: {
						'truck_id': row.truck_id
					}, //方法返回参数
					columns: [{
						title: "车牌号",
						field: 'license',
						align: 'center',
						valign: 'middle',
					}, {
						title: "车辆类型",
						field: 'trucktype',
						align: 'center',
						valign: 'middle',
					}, {
						title: "吨位",
						field: 'carry_capcty',
						align: 'center',
						valign: 'middle',
					}, {
						title: "车辆所有权",
						field: 'name',
						align: 'center',
						valign: 'middle',
					}, {
						title: "删除",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<button type='button' class='btn btn-danger glyphicon glyphicon-trash' onclick='delCar2()'></button>";

						}
					}]
				})

				/*修改：司机信息表格*/
				$("#UpDriverTable").bootstrapTable({
					url: "../schedule/upSelectOneDriver.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					queryParams: {
						'driver_id': row.driver_id 
					}, //方法返回参数
					columns: [{
						title: "司机名称",
						field: 'name',
						align: 'center',
						valign: 'middle',
					}, {
						title: "驾驶证",
						field: 'license',
						align: 'center',
						valign: 'middle',
					}, {
						title: "联系电话",
						field: 'contact',
						align: 'center',
						valign: 'middle',
					}, {
						title: "删除",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<button type='button' onclick='delDriver2()' class='btn btn-danger glyphicon glyphicon-trash'></button>";

						}
					}]
				})

				/*修改：承运商信息表格*/
				$("#UpCarrierTable").bootstrapTable({
					url: "../schedule/upSelectOneCarrier.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					queryParams: {
						'third_party_id': row.third_party_id
					}, //方法返回参数
					columns: [{
						title: "承运商姓名",
						field: 'name',
						align: 'center',
						valign: 'middle',
					}, {
						title: "地址",
						field: 'address',
						align: 'center',
						valign: 'middle',
					}, {
						title: "联系人",
						field: 'contact',
						align: 'center',
						valign: 'middle',
					}, {
						title: "承运商电话",
						field: 'phone',
						align: 'center',
						valign: 'middle',
					}, {
						title: "删除",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<button type='button' onclick='delCarrier2()' class='btn btn-danger glyphicon glyphicon-trash'></button>";

						}
					}]
				})
				
			/*修改：指定货物信息表格*/
				$("#UpProTable").bootstrapTable({
					url: "../schedule/upSelectOnePro.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					queryParams: {
						'sched_id': row.sched_id
					}, //方法返回参数, //方法返回参数
					columns: [{
						title: "货物名称",
						field: 'pname',
						align: 'center',
						valign: 'middle',
					},{
						title: "订单号",
						field: 'orderid',
						align: 'center',
						valign: 'middle',
					},{
						title: "货物编码",
						field: 'code',
						align: 'center',
						valign: 'middle',
					},{
						title: "货物型号",
						field: 'pmodel',
						align: 'center',
						valign: 'middle',
					},{
						title: "订单数量",
						field: 'pcount',
						align: 'center',
						valign: 'middle',
					},{
						title: "未调度数量",
						field: 'scount', 
						align: 'center',
						valign: 'middle',
					},{
						title: "调度数量",
//						field: 'nums', 
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return '<input type="hidden" class="odid" value='+row.oid+' name="odid"><div align="center"><input type="text" class="form-control nums" name="nums" id="" value="0"  style="width:100px" onblur="getNums('+row.scount+','+index+')"/></div>';

						}
					},{
						title: "删除",
						field: 'oid',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<button type='button' class='btn btn-danger glyphicon glyphicon-trash pids' value='"+row.oid+"' onclick='delPro("+row.oid+")'></button>";

						}
					}]
				})
				
				
				

			}

			//删除调度信息
			function delSchedule(id) {
				$.ajax({
					type: "post",
					url: "../schedule/delSchedule.lgg",
					data: "sched_id=" + id,
					success: function(data) {
						$("#scheduleTable").bootstrapTable("refresh")

					}
				});

			}

			//车辆信息模糊查询带参
			function carParams() {
				return {
					'owner_type_id': $("#otid").val(),
					'license': $("#license").val(),
					'trucktype': $("#trucktype").val()

				}

			}
			
			

			//删除指定车辆
			function delCar() {
				$("#carTable").bootstrapTable('removeAll');

			}

			//删除指定司机
			function delDriver() {
				$("#driverTable").bootstrapTable('removeAll');

			}

			//删除指定承运商
			function delCarrier() {
				$("#carrierTable").bootstrapTable('removeAll');

			}

			//删除指定车辆
			function delCar2() {
				$("#UpCarTable").bootstrapTable('removeAll');

			}

			//删除指定司机
			function delDriver2() {
				$("#UpDriverTable").bootstrapTable('removeAll');

			}

			//删除指定承运商
			function delCarrier2() {
				$("#UpCarrierTable").bootstrapTable('removeAll');

			}

			//司机信息模糊查询带参
			function driverParams() {
				return {
					'name': $("#dname").val(),
					'license': $("#dlicense").val(),
					'contact': $("#dcontact").val()
				}

			}

			//承运商信息模糊查询带参
			function thirdPartyParams() {
				return {
					'name': $("#cname").val(),
					'phone': $("#phone").val(),
					'contact': $("#ccontact").val()
				}
			}

			//指定车辆
			function appointCar(row) {
				$("#truck_id").val(row.truck_id)
				$("#truck_id2").val(row.truck_id)
				var car = {
					'license': row.license,
					'trucktype': row.trucktype,
					'carry_capcty': row.carry_capcty,
					'name': row.name
				}
				$("#carTable,#UpCarTable").bootstrapTable('removeAll')
				$("#carTable,#UpCarTable").bootstrapTable('append', car)
				$("#carModal").modal("hide")
			}

			//指定司机
			function appointDriver(row) {
				$("#driver_id").val(row.driver_id)
				$("#driver_id2").val(row.driver_id)
				var driver = {
					'name': row.name,
					'license': row.license,
					'contact': row.contact
				}
				$("#driverTable,#UpDriverTable").bootstrapTable('removeAll')
				$("#driverTable,#UpDriverTable").bootstrapTable('append', driver)
				$("#driverModal").modal("hide")
			}

			//指定承运商
			function appointCarrier(row) {
				$("#third_party_id").val(row.third_party_id)
				$("#third_party_id2").val(row.third_party_id)
				var carrier = {
					'name': row.name,
					'address': row.address,
					'contact': row.contact,
					'phone': row.phone
				}
				$("#carrierTable,#UpCarrierTable").bootstrapTable('removeAll')
				$("#carrierTable,#UpCarrierTable").bootstrapTable('append', carrier)
				$("#carrierModal").modal("hide")
			}

			function carrier() {
				$("#carrierModal").modal("show");
			}

			function car() {
				$("#carModal").modal("show");
			}

			function driver() {
				$("#driverModal").modal("show");
			}
			
			function addModal(){
				$("#carTable").bootstrapTable("removeAll")
				$("#driverTable").bootstrapTable("removeAll")
				$("#carrierTable").bootstrapTable("removeAll ")
				
			}
			
			function product(){
				
				$("#proModal").modal("show")
				/*货物信息表格*/
				$("#proTable").bootstrapTable({
					url: "../schedule/getAllPro.lgg",
					pagination: true, //分页
					pageSize: 5, //页面显示的数据
					queryParams:function(){
						return{
							"pname":$("#product_pname").val(),
							"code":$("#product_code").val(),
//							"provider":$("#product_provider").val()
						}
					},//方法返回参数
					columns: [{
						title: "货物名称",
						field: 'pname',
						align: 'center',
						valign: 'middle',
					},{
						title: "订单号",
						field: 'orderid',
						align: 'center',
						valign: 'middle',
					},{
						title: "货物编码",
						field: 'code',
						align: 'center',
						valign: 'middle',
					},{
						title: "货物型号",
						field: 'pmodel',
						align: 'center',
						valign: 'middle',
					},{
						title: "订单数量",
						field: 'pcount',
						align: 'center',
						valign: 'middle',
					},{
						title: "未调度数量",
						field: 'scount',
						align: 'center',
						valign: 'middle',
					},{
						title: "指定货物",
						//						field: 'shelfId',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index) {
							return "<a href='javascript:appointPro(" + JSON.stringify(row) + ")'><span class='glyphicon glyphicon-ok'></span></a>";
						}
						
					}]
				})

				
			}
			
			//删除货物信息
			function delPro(id){
				var ids = [];//定义一个数组
				ids.push(id);//将要删除的id存入数组
				$("#UpProTable").bootstrapTable('remove', {field: 'oid', values: ids});

			}
			
			
			//指定货物信息
			function appointPro(row){
				
				$(".odid").each(function(){
					$(this).val(row.oid)
					
				})
//				alert(row.pid)
//				$("#pid").val(row.pid)
//				$("#proTable").bootstrapTable('refresh'); 
				var pro = {
					'oid':row.oid,
					'pname':row.pname,
					'orderid':row.orderid,
					'code':row.code,
					'pmodel':row.pmodel,
					'pcount':row.pcount,
					'scount':row.scount
				}
				
				var isChange=false;
				 $('.pids').each(function(){
				 	
				       var id =  $(this).val();
//				       alert(id)
				       if (row.oid==id) {
				      		isChange = true;
				       } 
			  	});

				if(isChange!=true){
//					alert("change"+row.pid)
			  		$("#UpProTable").bootstrapTable('append', pro);
//			  		$("#UpProTable").parent().append('<input type="hidden" name="odid" id="odid" value="'+row.oid+'">');//work_order_id        int		     null,			-- 工作单id
			  	} 
				
//				if ($("button").is(".pids")==false) {
//					alert("button"+row.pid)
//			  		$("#UpProTable").bootstrapTable('append',pro);
//			  	}
			}
			
			//调度数量
			function getNums(scount,index){
				var nums=$(".nums:eq("+index+")").val();

				if (nums>=scount) {
					$(".nums:eq("+index+")").val(scount)
				}else if(nums<=0){
					$(".nums:eq("+index+")").val(0)
				}

			}
		</script>
	</head>

	<body>

		<div align="center">

			<button type="button" class="btn btn-primary btn-lg" onclick="addModal()" data-toggle="modal" data-target="#schedModal"><span class="glyphicon glyphicon-plus"></span> 创建调度</button>
		</div>

		<br />
		<table id="scheduleTable"></table>
		
		<!--创建调度模态框-->
		<form id="addForm">

			<div class="modal fade" id="schedModal" tabindex="-1" data="12" style="display: none;" role="dialog" aria-labelledby="myModalLabel">
				<div class="modal-dialog" role="document" style="width: 1000px;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
							<h4 class="modal-title" id="myModalLabel">创建调度</h4>
						</div>
						<div class="modal-body">
						<form id="f1">
						<table border="0" width="950" align="center" height="200">
							<tr>
								<td id="text"><label for="exampleInputEmail1">调度标记：</label></td>
								<td>
									<select name="exec_done_flag" class="form-control" style="width: 200px;">
										<option value="出库调度">出库调度</option>
										<option value="入库调度">入库调度</option>
									<lect>
								</td>
								<td id="text"><label for="exampleInputEmail1">调度类型：</label></td>
								<td>
									<select name="sched_type_id" class="form-control" style="width: 200px;">
										<option value="1">公路</option>
									</select>
								</td>
								<td id="text"><label for="exampleInputEmail1">调度总重量：</label></td>
								<td><input type="text" class="form-control" name="pcount" id="" value="" placeholder="调度货物总重量(kg)" style="width: 200px;" /></td>
							</tr>

							<tr>
								<td id="text"><label for="exampleInputEmail1">调度总体积：</label></td>
								<td><input type="text" class="form-control" name="hacount" id="" value="" placeholder="调度货物总体积(m³)" style="width: 200px;" /></td>
								<td id="text"><label for="exampleInputEmail1">调度单状态：</label></td>
								<td>
									<select name="schstatus" class="form-control" style="width: 200px;">
										<option value="正在调度">正在调度</option>
										<!--<option value="调度完成">调度完成</option>-->
									</select>
								</td>
								<td id="text"><label for="exampleInputEmail1">发货地：</label></td> 
								<td><input type="text" class="form-control" name="fromaddress" id="fromaddress" value="" placeholder="发货地点" style="width: 200px;" /></td>
								
							</tr>

							<tr>
								
								<td id="text"><label for="exampleInputEmail1">发货地坐标：</label></td>
								<td><input type="text" class="form-control" name="fromaddresszb" id="fromaddresszb" value="" placeholder="发货地坐标" style="width: 200px;" readonly="readonly" /></td>
								<td id="text"><label for="exampleInputEmail1">目的地：</label></td>
								<td><input type="text" class="form-control" name="toaddress" id="toaddress" value="" placeholder="目标地点" style="width: 200px;" /></td>
								<td id="text"><label for="exampleInputEmail1">目的地坐标：</label></td>
								<td><input type="text" class="form-control" name="toaddresszb" id="toaddresszb" value="" placeholder="目的地坐标" style="width: 200px;" readonly="readonly"/></td>

							</tr>

							<tr>
								<td id="text"><label for="exampleInputEmail1">客户名称：</label></td>
								<td><input type="text" class="form-control" name="cuname" id="" value="" placeholder="客户姓名" style="width: 200px;" /></td>
								<td id="text"><label for="exampleInputEmail1">联系电话：</label></td>
								<td><input type="text" class="form-control" name="cuphone" id="" value="" placeholder="客户手机号码" style="width: 200px;" /></td>

								<td colspan="2" align="center"></td>
							</tr>

						</table>

					</div>


						<!--车辆信息-->
						<div class="modal-header">
							<input type="hidden" name="truck_id" id="truck_id" value="" />
							<input type="hidden" name="driver_id" id="driver_id" value="" />
							<input type="hidden" name="third_party_id" id="third_party_id" value="" />
							
							<h4 class="modal-title" id="myModalLabel">车辆信息&emsp;<a href="javascript:car()"><span class="glyphicon glyphicon-hand-left"></span></a></h4>
						</div>
						<div class="modal-body">
							<table id="carTable"></table>
						</div>
						<div class="modal-footer">

						</div>

						<!--司机-->
						<div class="modal-header">
							<h4 class="modal-title" id="myModalLabel">司机信息&emsp;<a href="javascript:driver()"><span class="glyphicon glyphicon-hand-left"></span></a></h4>
						</div>
						<div class="modal-body">
							<table id="driverTable"></table>
						</div>
						<div class="modal-footer">

						</div>

						<!--承运商-->
						<div class="modal-header">
							<h4 class="modal-title" id="myModalLabel">承运商信息&emsp;<a href="javascript:carrier()"><span class="glyphicon glyphicon-hand-left"></span></a></h4>
						</div>
						<div class="modal-body">
							<table id="carrierTable"></table>
						</div>
						<div class="modal-footer">
							<button type="button" id="addSheduleBtn" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span> 提交调度</button>
						</div>
					</div>
				</div>
			</div>
		</form>

		<!--<button class="btn btn-default" data-toggle="modal" data-target="#carModal">车辆搜索</button>-->
		<!--<button class="btn btn-default" data-toggle="modal" data-target="#driverModal">司机搜索</button>-->
		<!--		<button class="btn btn-default" data-toggle="modal" data-target="#carrierModal">承运商搜索</button>
-->

		<!--修改调度模态框-->
		<form id="upForm">

			<div class="modal fade" id="upSchedModal" tabindex="-1" data="12" role="dialog" aria-labelledby="myModalLabel">
				<div class="modal-dialog" role="document" style="width: 1000px;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
							<h4 class="modal-title" id="myModalLabel">修改调度</h4>
						</div>
						
						<!--货物信息-->
						<div class="modal-header">
							<h4 class="modal-title" id="myModalLabel">货物信息&emsp;<a href="javascript:product()"><span class="glyphicon glyphicon-hand-left"></span></a></h4>
						</div>
						<div class="modal-body">
							<!--<input type="text"  />-->
							<table id="UpProTable"></table>
						</div>
						<div class="modal-footer">
							<input type="hidden" name="truck_id" id="truck_id2" value="" />
							<input type="hidden" name="driver_id" id="driver_id2" value="" />
							<input type="hidden" name="third_party_id" id="third_party_id2" value="" />
							<input type="hidden" name="sched_id" id="sched_id" value="" />
						</div>

						<!--车辆信息-->
						<div class="modal-header">
							<h4 class="modal-title" id="myModalLabel">车辆信息&emsp;<a href="javascript:car()"><span class="glyphicon glyphicon-hand-left"></span></a></h4>
						</div>
						<div class="modal-body">
							<table id="UpCarTable"></table>
						</div>
						<div class="modal-footer">

						</div>

						<!--司机-->
						<div class="modal-header">
							<h4 class="modal-title" id="myModalLabel">司机信息&emsp;<a href="javascript:driver()"><span class="glyphicon glyphicon-hand-left"></span></a></h4>
						</div>
						<div class="modal-body">
							<table id="UpDriverTable"></table>
						</div>
						<div class="modal-footer">

						</div>

						<!--承运商-->
						<div class="modal-header">
							<h4 class="modal-title" id="myModalLabel">承运商信息&emsp;<a href="javascript:carrier()"><span class="glyphicon glyphicon-hand-left"></span></a></h4>
						</div>
						<div class="modal-body">
							<table id="UpCarrierTable"></table>
						</div>
						<div class="modal-footer">
							<button type="button" id="upSheduleBtn" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span> 修改调度</button>
						</div>
					</div>
				</div>
			</div>
		</form>

		<!--指定车辆模态框-->
		<div class="modal fade" id="carModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document" style="width: 800px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title" id="myModalLabel">车辆搜索</h4>
					</div>
					<div class="modal-body">
						<div align="center">

							<form class="form-inline">
								<div class="form-group">

									<label for="exampleInputEmail2">查询：</label>

									<select id="otid" class="form-control">
										<option value="">-选择所有者-</option>
									</select>

									<input type="text" id="license" class="form-control" placeholder="请输入车牌号">

									<select id="trucktype" class="form-control">
										<option value="">-选择车辆类型-</option>
									</select>

									<button type="button" id="carBtn" class="btn btn-primary glyphicon glyphicon-search"></button>

								</div>

								<br />
								<br />
								<table id="carTable2"></table>

							</form>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-danger glyphicon glyphicon-remove" data-dismiss="modal"></button>
					</div>
				</div>
			</div>
		</div>

		<!--指定司机模态框-->
		<div class="modal fade" id="driverModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document" style="width: 800px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title" id="myModalLabel">司机搜索</h4>
					</div>
					<div class="modal-body">
						<div align="center">

							<form class="form-inline">
								<div class="form-group">

									<label for="exampleInputEmail2">查询：</label>

									<input type="text" id="dname" class="form-control" placeholder="请输入司机姓名">
									<input type="text" id="dlicense" class="form-control" placeholder="请输入驾驶证号">
									<input type="text" id="dcontact" class="form-control" placeholder="请输入司机电话">
									<button type="button" id="driverBtn" class="btn btn-primary glyphicon glyphicon-search"></button>

								</div>

								<br />
								<br />
								<table id="driverTable2"></table>

							</form>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-danger glyphicon glyphicon-remove" data-dismiss="modal"></button>
					</div>
				</div>
			</div>
		</div>

		<!--指定承运商模态框-->
		<div class="modal fade" id="carrierModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document" style="width: 800px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title" id="myModalLabel">承运商搜索</h4>
					</div>
					<div class="modal-body">
						<div align="center">

							<form class="form-inline">
								<div class="form-group">

									<label for="exampleInputEmail2">查询：</label>

									<input type="text" id="cname" class="form-control" placeholder="请输入承运商名称">
									<input type="text" id="phone" class="form-control" placeholder="请输入承运商电话">
									<input type="text" id="ccontact" class="form-control" placeholder="请输入联系人">

									<button type="button" id="carrierBtn" class="btn btn-primary glyphicon glyphicon-search"></button>

								</div>

								<br />
								<br />
								<table id="carrierTable2"></table>

							</form>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-danger glyphicon glyphicon-remove" data-dismiss="modal"></button>
					</div>
				</div>
			</div>
		</div>

		<!--指定货物模态框-->
		<div class="modal fade" id="proModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document" style="width: 800px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title" id="myModalLabel">货物搜索</h4>
						
					</div>
					<div class="modal-body">
						<div align="center">

							<form class="form-inline">
								<div class="form-group">
			
									<label for="exampleInputEmail2">查询：</label>
									<!--<input type="text" id="pid" name="pid" value=""/>-->
									<input type="text" id="product_pname" class="form-control" placeholder="请输入商品名称">
									<!--<input type="text" id="product_provider" class="form-control" placeholder="请输入供应商">-->
									<input type="text" id="product_code" class="form-control" placeholder="请输入货物编码">

									<button type="button" id="proBtn" class="btn btn-primary glyphicon glyphicon-search"></button>

								</div>

								<br />
								<br />
								<table id="proTable"></table>

							</form>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-danger glyphicon glyphicon-remove" data-dismiss="modal"></button>
					</div>
				</div>
			</div>
		</div>


	</body>

</html>